package com.xhh.nphm.web.controller.system;

import com.xhh.nphm.common.core.controller.BaseController;
import com.xhh.nphm.common.core.page.TableDataInfo;
import com.xhh.nphm.system.domain.TwfJudgeEty;
import com.xhh.nphm.system.service.ITwfJudgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/twfJudge")
public class TwfJudgeController extends BaseController {
    private String prefix="system/twfJudge";
    @Autowired
    private ITwfJudgeService twfJudgeService;

    /**
     * 回访记录列表 页面
     * @param wfId
     * @param map
     * @return
     */
    @GetMapping("/judgeList/{wfId}")
    public ModelAndView judgeList(@PathVariable Integer wfId, ModelMap map) {
        map.put("wfId",wfId);
        return new ModelAndView(prefix+"/judgeList");
    }

    /**
     * 回访记录列表数据
     * @param
     * @return
     */
    @PostMapping("judgeListJson/{wfId}")
    public TableDataInfo judgeListJson(@PathVariable Integer wfId) {
        startPage();
        List<Map<String, Object>> list = twfJudgeService.selectByWfId(wfId);
        return getDataTable(list);
    }

    /**
     * 回访详情 页面
     */
    @GetMapping("/judgeDetail/{pkId}")
    public ModelAndView judgeDetail(@PathVariable Integer pkId,ModelMap map) {
        TwfJudgeEty twfJudgeEty = twfJudgeService.getById(pkId);
        map.put("twfJudge",twfJudgeEty);
        return new ModelAndView(prefix+"/judgeDetail");
    }

    /**
     * 处理已回访工单页面-回访情况列表数据
     */
    @PostMapping("/backRsltDeal/judgeList/{wfId}")
    public TableDataInfo backRsltDealJudgeListJson(@PathVariable("wfId")Integer wfId){
        startPage();
        List<TwfJudgeEty> list = twfJudgeService.backRsltDealJudgeListJson(wfId);
        return getDataTable(list);
    }
}
